package com.vitabuybuy.tv.ui.shopcenter.viewmodel

import androidx.lifecycle.MutableLiveData
import com.library.common.base.BaseViewModel
import com.library.common.ext.rxHttpRequest
import com.library.common.net.error.msg
import com.library.common.toast.XToast
import com.vitabuybuy.tv.dto.ClassificationDto
import com.vitabuybuy.tv.network.ShopCenterRepository

class ClassificationViewModel : BaseViewModel() {
    val firstCateList = MutableLiveData<MutableList<ClassificationDto>>()

    fun getClassification() {
        rxHttpRequest {
            onRequest = {
                firstCateList.value= ShopCenterRepository.getClassification().await()
            }
            onError = {
                XToast.normal(it.msg)
            }
        }
    }
}
